import 'package:flame/util.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:shared_preferences/shared_preferences.dart';

import 'game_controller.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  final flameUtil = Util();
  await flameUtil.fullScreen();
  await flameUtil.setOrientation(DeviceOrientation.portraitUp);
  final storage = await SharedPreferences.getInstance();
  final controller = GameController(storage);
  runApp(controller.widget);

  final tapRecognizer = TapGestureRecognizer();
  tapRecognizer.onTapDown = controller.onTapDown;
  flameUtil.addGestureRecognizer(tapRecognizer);
}
